<template>
  <!-- 中间部分工作区域组件 -->
  <div  id="homePage">
    <div id="main">
      <div class="p-tb5"></div>
      <div  v-if="notices!=null">
        <div class="cursor" @click="openInfo(notices.id)">
          <el-alert
            title="最新公告"
            type="warning"
            :closable="!1"
            :description="notices.descript"
            show-icon>
          </el-alert>
        </div>
      </div>
      <div class="p-tb5"></div>
      <div>
        <div v-for="(x,index) in 20" :key="index" style="height:50px;">1</div>
      </div>
    </div>
  </div>
</template>
<script type="es6" scoped>
  export default {
    name:"homePage",
    data() {
      return {
        visible:false,
        userAsset:null,
        games:[],
        notices:null,
        images: [],
        other:[
        ]
      }
    },
    methods: {
      init() {
      },
      initNotices(){
        if(this.$store.getters.getConfig()!=null&&this.$store.getters.getConfig().noticeBarId!=null){
          this.proAPI.getJson(this.proAPI.URLS.getInformationById,{id:this.$store.getters.getConfig().noticeBarId}).then((res)=>{
            this.notices = res.data;
          })
        }
      },
      openInfo(id){
        var t={};
        t.id = id;
        var route = {
          path:'/info/information',	//路径
          name:'详情',	//配置路由时的name
          query:t
        }
        this.$router.push(route);
      }
    },
    beforeCreate: function() {
    },
    created: function() {
    },
    beforeMount: function() {
    },
    mounted: function() {
      this.$nextTick(()=>{
        this.init();
      })
    },
    beforeUpdate: function() {
    },
    updated: function() {
    },
    activated: function() {
      setTimeout(()=>{
        if(this.games.length==0){
          console.log(1);
          this.init();
        }
      },1000)
      // if(!this.$store.state.ws||this.$store.state.ws.readyState!=1){
      //   console.log("ws状态不正确,重新链接");
      //   this.$store.state.ws=null;
      //   this.initWs();
      // }
    },
    deactivated: function() {
    },
    beforeDestroy: function() {
    },
    destroyed: function() {
    },
    errorCaptured: function(err, vm, info) {
    }
  }
</script>
<style scoped lang="scss">
</style>
